-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the override of all version
package variables
#61
Allow the override of all version
package variables
#61
Conversation
This now makes it possible to override all variables via the `-X` ldflag, for example: ```go package main import ( "fmt" "sigs.k8s.io/release-utils/version" ) func main() { v := version.GetVersionInfo() fmt.Print(v.String()) } ``` ``` > go run -ldflags '\ -X sigs.k8s.io/release-utils/version.gitVersion=1 \ -X sigs.k8s.io/release-utils/version.gitCommit=2 \ -X sigs.k8s.io/release-utils/version.gitTreeState=3 \ -X sigs.k8s.io/release-utils/version.buildDate=4 \ -X sigs.k8s.io/release-utils/version.goVersion=5 \ -X sigs.k8s.io/release-utils/version.compiler=6 \ -X sigs.k8s.io/release-utils/version.platform=7' \ main.go GitVersion: 1 GitCommit: 2 GitTreeState: 3 BuildDate: 4 GoVersion: 5 Compiler: 6 Platform: 7 ``` Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Nice. Im happy with this as is, but another option would be to use buildinfo first and if its empty use the vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
should we do a release after this get merged?
@cpanato yes, do you wanna take care of that? |
will do! |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This now makes it possible to override all variables via the
-X
ldflag, for example:Which issue(s) this PR fixes:
Fixes #59
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?